<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul class="menu" style="position: absolute;">

    </ul>
    <script>
        var ul = document.querySelector('.menu')
        
        document.oncontextmenu = function(e){
            ul.innerHTML = '<li>复制</li><li>粘贴</li><li>剪切</li><li>查询</li>'
            ul.style.left = e.clientX + 'px'
            ul.style.top = e.clientY + 'px'
            ul.style.display = 'block'
            document.onclick = function(){
                ul.style.display = 'none'
            }
            if(e.preventDefault){
                e.preventDefault()
            }else{
                return false
            }
        }
    </script>
</body>
</html>